home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / gdb.info-3 < prev    next >
Encoding:
Text File  |  1992-04-11  |  49.4 KB  |  1,313 lines

  1. Info file ./gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                   The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.04, March 1992, of `Using GDB: A Guide to the GNU
  10. Source-Level Debugger' for GDB Version 4.5.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software
  13. Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of
  16. this manual provided the copyright notice and this permission notice
  17. are preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the section entitled "GNU General Public License" is included
  22. exactly as in the original, and provided that the entire resulting
  23. derived work is distributed under the terms of a permission notice
  24. identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public
  29. License" may be included in a translation approved by the Free
  30. Software Foundation instead of in the original English.
  31.  
  32. 
  33. File: gdb.info,  Node: Selection,  Next: Frame Info,  Prev: Backtrace,  Up: Stack
  34.  
  35. Selecting a Frame
  36. =================
  37.  
  38.    Most commands for examining the stack and other data in your
  39. program work on whichever stack frame is selected at the moment.  Here
  40. are the commands for selecting a stack frame; all of them finish by
  41. printing a brief description of the stack frame just selected.
  42.  
  43. `frame N'
  44. `f N'
  45.      Select frame number N.  Recall that frame zero is the innermost
  46.      (currently executing) frame, frame one is the frame that called
  47.      the innermost one, and so on.  The highest-numbered frame is
  48.      `main''s frame.
  49.  
  50. `frame ADDR'
  51. `f ADDR'
  52.      Select the frame at address ADDR.  This is useful mainly if the
  53.      chaining of stack frames has been damaged by a bug, making it
  54.      impossible for GDB to assign numbers properly to all frames.  In
  55.      addition, this can be useful when your program has multiple
  56.      stacks and switches between them.
  57.  
  58.      On the SPARC architecture, `frame' needs two addresses to select
  59.      an arbitrary frame: a frame pointer and a stack pointer.
  60.  
  61. `up N'
  62.      Move N frames up the stack.  For positive numbers N, this
  63.      advances toward the outermost frame, to higher frame numbers, to
  64.      frames that have existed longer.  N defaults to one.
  65.  
  66. `down N'
  67.      Move N frames down the stack.  For positive numbers N, this
  68.      advances toward the innermost frame, to lower frame numbers, to
  69.      frames that were created more recently.  N defaults to one.  You
  70.      may abbreviate `down' as `do'.
  71.  
  72.    All of these commands end by printing two lines of output
  73. describing the frame.  The first line shows the frame number, the
  74. function name, the arguments, and the source file and line number of
  75. execution in that frame.  The second line shows the text of that
  76. source line.  For example:
  77.  
  78.      (gdb) up
  79.      #1  0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
  80.          at env.c:10
  81.      10              read_input_file (argv[i]);
  82.  
  83.    After such a printout, the `list' command with no arguments will
  84. print ten lines centered on the point of execution in the frame. 
  85. *Note Printing Source Lines: List.
  86.  
  87. `up-silently N'
  88. `down-silently N'
  89.      These two commands are variants of `up' and `down', respectively;
  90.      they differ in that they do their work silently, without causing
  91.      display of the new frame.  They are intended primarily for use in
  92.      GDB command scripts, where the output might be unnecessary and
  93.      distracting.
  94.  
  95. 
  96. File: gdb.info,  Node: Frame Info,  Prev: Selection,  Up: Stack
  97.  
  98. Information About a Frame
  99. =========================
  100.  
  101.    There are several other commands to print information about the
  102. selected stack frame.
  103.  
  104. `frame'
  105. `f'
  106.      When used without any argument, this command does not change which
  107.      frame is selected, but prints a brief description of the currently
  108.      selected stack frame.  It can be abbreviated `f'.  With an
  109.      argument, this command is used to select a stack frame (*note
  110.      Selecting a Frame: Selection.).
  111.  
  112. `info frame'
  113. `info f'
  114.      This command prints a verbose description of the selected stack
  115.      frame, including the address of the frame, the addresses of the
  116.      next frame down (called by this frame) and the next frame up
  117.      (caller of this frame), the language that the source code
  118.      corresponding to this frame was written in, the address of the
  119.      frame's arguments, the program counter saved in it (the address
  120.      of execution in the caller frame), and which registers were saved
  121.      in the frame.  The verbose description is useful when something
  122.      has gone wrong that has made the stack format fail to fit the
  123.      usual conventions.
  124.  
  125. `info frame ADDR'
  126. `info f ADDR'
  127.      Print a verbose description of the frame at address ADDR, without
  128.      selecting that frame.  The selected frame remains unchanged by
  129.      this command.
  130.  
  131. `info args'
  132.      Print the arguments of the selected frame, each on a separate
  133.      line.
  134.  
  135. `info locals'
  136.      Print the local variables of the selected frame, each on a
  137.      separate line.  These are all variables declared static or
  138.      automatic within all program blocks that execution in this frame
  139.      is currently inside of.
  140.  
  141. `info catch'
  142.      Print a list of all the exception handlers that are active in the
  143.      current stack frame at the current point of execution.  To see
  144.      other exception handlers, visit the associated frame (using the
  145.      `up', `down', or `frame' commands); then type `info catch'. 
  146.      *Note Breakpoints and Exceptions: Exception Handling.
  147.  
  148. 
  149. File: gdb.info,  Node: Source,  Next: Data,  Prev: Stack,  Up: Top
  150.  
  151. Examining Source Files
  152. **********************
  153.  
  154.    GDB can print parts of your program's source, since the debugging
  155. information recorded in your program tells GDB what source files were
  156. used to build it.  When your program stops, GDB spontaneously prints
  157. the line where it stopped.  Likewise, when you select a stack frame
  158. (*note Selecting a Frame: Selection.), GDB prints the line where
  159. execution in that frame has stopped.  You can print other portions of
  160. source files by explicit command.
  161.  
  162.    If you use GDB through its GNU Emacs interface, you may prefer to
  163. use Emacs facilities to view source; *note Using GDB under GNU Emacs:
  164. Emacs..
  165.  
  166. * Menu:
  167.  
  168. * List::                        Printing Source Lines
  169. * Search::                      Searching Source Files
  170. * Source Path::                 Specifying Source Directories
  171. * Machine Code::                Source and Machine Code
  172.  
  173. 
  174. File: gdb.info,  Node: List,  Next: Search,  Prev: Source,  Up: Source
  175.  
  176. Printing Source Lines
  177. =====================
  178.  
  179.    To print lines from a source file, use the `list' command
  180. (abbreviated `l').  There are several ways to specify what part of the
  181. file you want to print.
  182.  
  183.    Here are the forms of the `list' command most commonly used:
  184.  
  185. `list LINENUM'
  186.      Print lines centered around line number LINENUM in the current
  187.      source file.
  188.  
  189. `list FUNCTION'
  190.      Print lines centered around the beginning of function FUNCTION.
  191.  
  192. `list'
  193.      Print more lines.  If the last lines printed were printed with a
  194.      `list' command, this prints lines following the last lines
  195.      printed; however, if the last line printed was a solitary line
  196.      printed as part of displaying a stack frame (*note Examining the
  197.      Stack: Stack.), this prints lines centered around that line.
  198.  
  199. `list -'
  200.      Print lines just before the lines last printed.
  201.  
  202.    By default, GDB prints ten source lines with any of these forms of
  203. the `list' command.  You can change this using `set listsize':
  204.  
  205. `set listsize COUNT'
  206.      Make the `list' command display COUNT source lines (unless the
  207.      `list' argument explicitly specifies some other number).
  208.  
  209. `show listsize'
  210.      Display the number of lines that `list' will currently display by
  211.      default.
  212.  
  213.    Repeating a `list' command with RET discards the argument, so it is
  214. equivalent to typing just `list'.  This is more useful than listing
  215. the same lines again.  An exception is made for an argument of `-';
  216. that argument is preserved in repetition so that each repetition moves
  217. up in the source file.
  218.  
  219.    In general, the `list' command expects you to supply zero, one or
  220. two "linespecs".  Linespecs specify source lines; there are several
  221. ways of writing them but the effect is always to specify some source
  222. line.  Here is a complete description of the possible arguments for
  223. `list':
  224.  
  225. `list LINESPEC'
  226.      Print lines centered around the line specified by LINESPEC.
  227.  
  228. `list FIRST,LAST'
  229.      Print lines from FIRST to LAST.  Both arguments are linespecs.
  230.  
  231. `list ,LAST'
  232.      Print lines ending with LAST.
  233.  
  234. `list FIRST,'
  235.      Print lines starting with FIRST.
  236.  
  237. `list +'
  238.      Print lines just after the lines last printed.
  239.  
  240. `list -'
  241.      Print lines just before the lines last printed.
  242.  
  243. `list'
  244.      As described in the preceding table.
  245.  
  246.    Here are the ways of specifying a single source line--all the kinds
  247. of linespec.
  248.  
  249. `NUMBER'
  250.      Specifies line NUMBER of the current source file.  When a `list'
  251.      command has two linespecs, this refers to the same source file as
  252.      the first linespec.
  253.  
  254. `+OFFSET'
  255.      Specifies the line OFFSET lines after the last line printed. 
  256.      When used as the second linespec in a `list' command that has
  257.      two, this specifies the line OFFSET lines down from the first
  258.      linespec.
  259.  
  260. `-OFFSET'
  261.      Specifies the line OFFSET lines before the last line printed.
  262.  
  263. `FILENAME:NUMBER'
  264.      Specifies line NUMBER in the source file FILENAME.
  265.  
  266. `FUNCTION'
  267.      Specifies the line of the open-brace that begins the body of the
  268.      function FUNCTION.
  269.  
  270. `FILENAME:FUNCTION'
  271.      Specifies the line of the open-brace that begins the body of the
  272.      function FUNCTION in the file FILENAME.  You only need the file
  273.      name with a function name to avoid ambiguity when there are
  274.      identically named functions in different source files.
  275.  
  276. `*ADDRESS'
  277.      Specifies the line containing the program address ADDRESS. 
  278.      ADDRESS may be any expression.
  279.  
  280. 
  281. File: gdb.info,  Node: Search,  Next: Source Path,  Prev: List,  Up: Source
  282.  
  283. Searching Source Files
  284. ======================
  285.  
  286.    There are two commands for searching through the current source
  287. file for a regular expression.
  288.  
  289. `forward-search REGEXP'
  290. `search REGEXP'
  291.      The command `forward-search REGEXP' checks each line, starting
  292.      with the one following the last line listed, for a match for
  293.      REGEXP.  It lists the line that is found.  You can use synonym
  294.      `search REGEXP' or abbreviate the command name as `fo'.
  295.  
  296. `reverse-search REGEXP'
  297.      The command `reverse-search REGEXP' checks each line, starting
  298.      with the one before the last line listed and going backward, for
  299.      a match for REGEXP.  It lists the line that is found.  You can
  300.      abbreviate this command as `rev'.
  301.  
  302. 
  303. File: gdb.info,  Node: Source Path,  Next: Machine Code,  Prev: Search,  Up: Source
  304.  
  305. Specifying Source Directories
  306. =============================
  307.  
  308.    Executable programs sometimes do not record the directories of the
  309. source files from which they were compiled, just the names.  Even when
  310. they do, the directories could be moved between the compilation and
  311. your debugging session.  GDB has a list of directories to search for
  312. source files; this is called the "source path".  Each time GDB wants a
  313. source file, it tries all the directories in the list, in the order
  314. they are present in the list, until it finds a file with the desired
  315. name.  Note that the executable search path is *not* used for this
  316. purpose.  Neither is the current working directory, unless it happens
  317. to be in the source path.
  318.  
  319.    If GDB cannot find a source file in the source path, and the object
  320. program records a directory, GDB tries that directory too.  If the
  321. source path is empty, and there is no record of the compilation
  322. directory, GDB will, as a last resort, look in the current directory.
  323.  
  324.    Whenever you reset or rearrange the source path, GDB will clear out
  325. any information it has cached about where source files are found, where
  326. each line is in the file, etc.
  327.  
  328.    When you start GDB, its source path is empty.  To add other
  329. directories, use the `directory' command.
  330.  
  331. `directory DIRNAME ...'
  332.      Add directory DIRNAME to the front of the source path.  Several
  333.      directory names may be given to this command, separated by `:' or
  334.      whitespace.  You may specify a directory that is already in the
  335.      source path; this moves it forward, so it will be searched sooner.
  336.  
  337.      You can use the string `$cdir' to refer to the compilation
  338.      directory (if one is recorded), and `$cwd' to refer to the current
  339.      working directory.  `$cwd' is not the same as `.'--the former
  340.      tracks the current working directory as it changes during your GDB
  341.      session, while the latter is immediately expanded to the current
  342.      directory at the time you add an entry to the source path.
  343.  
  344. `directory'
  345.      Reset the source path to empty again.  This requires confirmation.
  346.  
  347. `show directories'
  348.      Print the source path: show which directories it contains.
  349.  
  350.    If your source path is cluttered with directories that are no
  351. longer of interest, GDB may sometimes cause confusion by finding the
  352. wrong versions of source.  You can correct the situation as follows:
  353.  
  354.   1. Use `directory' with no argument to reset the source path to
  355.      empty.
  356.  
  357.   2. Use `directory' with suitable arguments to reinstall the
  358.      directories you want in the source path.  You can add all the
  359.      directories in one command.
  360.  
  361. 
  362. File: gdb.info,  Node: Machine Code,  Prev: Source Path,  Up: Source
  363.  
  364. Source and Machine Code
  365. =======================
  366.  
  367.    You can use the command `info line' to map source lines to program
  368. addresses (and viceversa), and the command `disassemble' to display a
  369. range of addresses as machine instructions.
  370.  
  371. `info line LINESPEC'
  372.      Print the starting and ending addresses of the compiled code for
  373.      source line LINESPEC.  You can specify source lines in any of the
  374.      ways understood by the `list' command (*note Printing Source
  375.      Lines: List.).
  376.  
  377.    For example, we can use `info line' to discover the location of the
  378. object code for the first line of function `m4_changequote':
  379.  
  380.      (gdb) info line m4_changecom
  381.      Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350.
  382.  
  383. We can also inquire (using `*ADDR' as the form for LINESPEC) what
  384. source line covers a particular address:
  385.      (gdb) info line *0x63ff
  386.      Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.
  387.  
  388.    After `info line', the default address for the `x' command is
  389. changed to the starting address of the line, so that `x/i' is
  390. sufficient to begin examining the machine code (*note Examining
  391. Memory: Memory.).  Also, this address is saved as the value of the
  392. convenience variable `$_' (*note Convenience Variables: Convenience
  393. Vars.).
  394.  
  395. `disassemble'
  396.      This specialized command dumps a range of memory as machine
  397.      instructions.  The default memory range is the function
  398.      surrounding the program counter of the selected frame.  A single
  399.      argument to this command is a program counter value; the function
  400.      surrounding this value will be dumped.  Two arguments specify a
  401.      range of addresses (first inclusive, second exclusive) to dump.
  402.  
  403.    We can use `disassemble' to inspect the object code range shown in
  404. the last `info line' example:
  405.  
  406.      (gdb) disas 0x63e4 0x6404
  407.      Dump of assembler code from 0x63e4 to 0x6404:
  408.      0x63e4 builtin_init+5340:     ble 0x63f8 builtin_init+5360
  409.      0x63e8 builtin_init+5344:     sethi %hi(0x4c00), %o0
  410.      0x63ec builtin_init+5348:     ld [%i1+4], %o0
  411.      0x63f0 builtin_init+5352:     b 0x63fc builtin_init+5364
  412.      0x63f4 builtin_init+5356:     ld [%o0+4], %o0
  413.      0x63f8 builtin_init+5360:     or %o0, 0x1a4, %o0
  414.      0x63fc builtin_init+5364:     call 0x9288 path_search
  415.      0x6400 builtin_init+5368:     nop
  416.      End of assembler dump.
  417.  
  418. 
  419. File: gdb.info,  Node: Data,  Next: Languages,  Prev: Source,  Up: Top
  420.  
  421. Examining Data
  422. **************
  423.  
  424.    The usual way to examine data in your program is with the `print'
  425. command (abbreviated `p'), or its synonym `inspect'.  It evaluates and
  426. prints the value of an expression of the language your program is
  427. written in (*note Using GDB with Different Languages: Languages.).
  428.  
  429. `print EXP'
  430. `print /F EXP'
  431.      EXP is an expression (in the source language).  By default the
  432.      value of EXP is printed in a format appropriate to its data type;
  433.      you can choose a different format by specifying `/F', where F is
  434.      a letter specifying the format; *note Output formats::..
  435.  
  436. `print'
  437. `print /F'
  438.      If you omit EXP, GDB displays the last value again (from the
  439.      "value history"; *note Value History: Value History.).  This
  440.      allows you to conveniently inspect the same value in an
  441.      alternative format.
  442.  
  443.    A more low-level way of examining data is with the `x' command.  It
  444. examines data in memory at a specified address and prints it in a
  445. specified format.  *Note Examining Memory: Memory.
  446.  
  447.    If you are interested in information about types, or about how the
  448. fields of a struct or class are declared, use the `ptype EXP' command
  449. rather than `print'. *Note Examining the Symbol Table: Symbols.
  450.  
  451. * Menu:
  452.  
  453. * Expressions::                 Expressions
  454. * Variables::                   Program Variables
  455. * Arrays::                      Artificial Arrays
  456. * Output formats::              Output formats
  457. * Memory::                      Examining Memory
  458. * Auto Display::                Automatic Display
  459. * Print Settings::              Print Settings
  460. * Value History::               Value History
  461. * Convenience Vars::            Convenience Variables
  462. * Registers::                   Registers
  463. * Floating Point Hardware::     Floating Point Hardware
  464.  
  465. 
  466. File: gdb.info,  Node: Expressions,  Next: Variables,  Prev: Data,  Up: Data
  467.  
  468. Expressions
  469. ===========
  470.  
  471.    `print' and many other GDB commands accept an expression and
  472. compute its value.  Any kind of constant, variable or operator defined
  473. by the programming language you are using is legal in an expression in
  474. GDB.  This includes conditional expressions, function calls, casts and
  475. string constants.  It unfortunately does not include symbols defined
  476. by preprocessor `#define' commands.
  477.  
  478.    Because C is so widespread, most of the expressions shown in
  479. examples in this manual are in C.  *Note Using GDB with Different
  480. Languages: Languages, for information on how to use expressions in
  481. other languages.
  482.  
  483.    In this section, we discuss operators that you can use in GDB
  484. expressions regardless of your programming language.
  485.  
  486.    Casts are supported in all languages, not just in C, because it is
  487. so useful to cast a number into a pointer so as to examine a structure
  488. at that address in memory.
  489.  
  490.    GDB supports these operators in addition to those of programming
  491. languages:
  492.  
  493. `@'
  494.      `@' is a binary operator for treating parts of memory as arrays. 
  495.      *Note Artificial Arrays: Arrays, for more information.
  496.  
  497. `::'
  498.      `::' allows you to specify a variable in terms of the file or
  499.      function where it is defined.  *Note Program Variables: Variables.
  500.  
  501. `{TYPE} ADDR'
  502.      Refers to an object of type TYPE stored at address ADDR in
  503.      memory.  ADDR may be any expression whose value is an integer or
  504.      pointer (but parentheses are required around binary operators,
  505.      just as in a cast).  This construct is allowed regardless of what
  506.      kind of data is normally supposed to reside at ADDR.
  507.  
  508. 
  509. File: gdb.info,  Node: Variables,  Next: Arrays,  Prev: Expressions,  Up: Data
  510.  
  511. Program Variables
  512. =================
  513.  
  514.    The most common kind of expression to use is the name of a variable
  515. in your program.
  516.  
  517.    Variables in expressions are understood in the selected stack frame
  518. (*note Selecting a Frame: Selection.); they must either be global (or
  519. static) or be visible according to the scope rules of the programming
  520. language from the point of execution in that frame.  This means that
  521. in the function
  522.  
  523.      foo (a)
  524.           int a;
  525.      {
  526.        bar (a);
  527.        {
  528.          int b = test ();
  529.          bar (b);
  530.        }
  531.      }
  532.  
  533. the variable `a' is usable whenever your program is executing within
  534. the function `foo', but the variable `b' is visible only while your
  535. program is executing inside the block in which `b' is declared.
  536.  
  537.    There is an exception: you can refer to a variable or function whose
  538. scope is a single source file even if the current execution point is
  539. not in this file.  But it is possible to have more than one such
  540. variable or function with the same name (in different source files). 
  541. If that happens, referring to that name has unpredictable effects.  If
  542. you wish, you can specify a static variable in a particular function
  543. or file, using the colon-colon notation:
  544.  
  545.      FILE::VARIABLE
  546.      FUNCTION::VARIABLE
  547.  
  548. Here FILE or FUNCTION is the name of the context for the static
  549. VARIABLE.
  550.  
  551.    This use of `::' is very rarely in conflict with the very similar
  552. use of the same notation in C++.  GDB also supports use of the C++
  553. scope resolution operator in GDB expressions.
  554.  
  555.      *Warning:* Occasionally, a local variable may appear to have the
  556.      wrong value at certain points in a function--just after entry to
  557.      the function, and just before exit.  You may see this problem
  558.      when you are stepping by machine instructions.  This is because
  559.      on most machines, it takes more than one instruction to set up a
  560.      stack frame (including local variable definitions); if you are
  561.      stepping by machine instructions, variables may appear to have
  562.      the wrong values until the stack frame is completely built.  On
  563.      function exit, it usually also takes more than one machine
  564.      instruction to destroy a stack frame; after you begin stepping
  565.      through that group of instructions, local variable definitions
  566.      may be gone.
  567.  
  568. 
  569. File: gdb.info,  Node: Arrays,  Next: Output formats,  Prev: Variables,  Up: Data
  570.  
  571. Artificial Arrays
  572. =================
  573.  
  574.    It is often useful to print out several successive objects of the
  575. same type in memory; a section of an array, or an array of dynamically
  576. determined size for which only a pointer exists in the program.
  577.  
  578.    This can be done by constructing an "artificial array" with the
  579. binary operator `@'.  The left operand of `@' should be the first
  580. element of the desired array, as an individual object.  The right
  581. operand should be the desired length of the array.  The result is an
  582. array value whose elements are all of the type of the left argument. 
  583. The first element is actually the left argument; the second element
  584. comes from bytes of memory immediately following those that hold the
  585. first element, and so on.  Here is an example.  If a program says
  586.  
  587.      int *array = (int *) malloc (len * sizeof (int));
  588.  
  589. you can print the contents of `array' with
  590.  
  591.      p *array@len
  592.  
  593.    The left operand of `@' must reside in memory.  Array values made
  594. with `@' in this way behave just like other arrays in terms of
  595. subscripting, and are coerced to pointers when used in expressions. 
  596. Artificial arrays most often appear in expressions via the value
  597. history (*note Value History: Value History.), after printing one out.)
  598.  
  599.    Sometimes the artificial array mechanism is not quite enough; in
  600. moderately complex data structures, the elements of interest may not
  601. actually be adjacent--for example, if you are interested in the values
  602. of pointers in an array.  One useful work-around in this situation is
  603. to use a convenience variable (*note Convenience Variables:
  604. Convenience Vars.) as a counter in an expression that prints the first
  605. interesting value, and then repeat that expression via RET.  For
  606. instance, suppose you have an array `dtab' of pointers to structures,
  607. and you are interested in the values of a field `fv' in each
  608. structure.  Here is an example of what you might type:
  609.  
  610.      set $i = 0
  611.      p dtab[$i++]->fv
  612.      RET
  613.      RET
  614.      ...
  615.  
  616. 
  617. File: gdb.info,  Node: Output formats,  Next: Memory,  Prev: Arrays,  Up: Data
  618.  
  619. Output formats
  620. ==============
  621.  
  622.    By default, GDB prints a value according to its data type. 
  623. Sometimes this is not what you want.  For example, you might want to
  624. print a number in hex, or a pointer in decimal.  Or you might want to
  625. view data in memory at a certain address as a character string or as
  626. an instruction.  To do these things, specify an "output format" when
  627. you print a value.
  628.  
  629.    The simplest use of output formats is to say how to print a value
  630. already computed.  This is done by starting the arguments of the
  631. `print' command with a slash and a format letter.  The format letters
  632. supported are:
  633.  
  634. `x'
  635.      Regard the bits of the value as an integer, and print the integer
  636.      in hexadecimal.
  637.  
  638. `d'
  639.      Print as integer in signed decimal.
  640.  
  641. `u'
  642.      Print as integer in unsigned decimal.
  643.  
  644. `o'
  645.      Print as integer in octal.
  646.  
  647. `t'
  648.      Print as integer in binary.  The letter `t' stands for "two".
  649.  
  650. `a'
  651.      Print as an address, both absolute in hex and as an offset from
  652.      the nearest preceding symbol.  This format can be used to
  653.      discover where (in what function) an unknown address is located:
  654.  
  655.           (gdb) p/a 0x54320
  656.           $3 = 0x54320 <_initialize_vx+396>
  657.  
  658. `c'
  659.      Regard as an integer and print it as a character constant.
  660.  
  661. `f'
  662.      Regard the bits of the value as a floating point number and print
  663.      using typical floating point syntax.
  664.  
  665.    For example, to print the program counter in hex (*note
  666. Registers::.), type
  667.  
  668.      p/x $pc
  669.  
  670. Note that no space is required before the slash; this is because
  671. command names in GDB cannot contain a slash.
  672.  
  673.    To reprint the last value in the value history with a different
  674. format, you can use the `print' command with just a format and no
  675. expression.  For example, `p/x' reprints the last value in hex.
  676.  
  677. 
  678. File: gdb.info,  Node: Memory,  Next: Auto Display,  Prev: Output formats,  Up: Data
  679.  
  680. Examining Memory
  681. ================
  682.  
  683.    You can use the command `x' (for "examine") to examine memory in
  684. any of several formats, independently of your program's data types.
  685.  
  686. `x/NFU ADDR'
  687. `x ADDR'
  688. `x'
  689.      Use the command `x' to examine memory.
  690.  
  691.    N, F, and U are all optional parameters that specify how much
  692. memory to display and how to format it; ADDR is an expression giving
  693. the address where you want to start displaying memory.  If you use
  694. defaults for NFU, you need not type the slash `/'.  Several commands
  695. set convenient defaults for ADDR.
  696.  
  697. N, the repeat count
  698.      The repeat count is a decimal integer; the default is 1.  It
  699.      specifies how much memory (counting by units U) to display.
  700.  
  701. F, the display format
  702.      The display format is one of the formats used by `print', or `s'
  703.      (null-terminated string) or `i' (machine instruction).  The
  704.      default is `x' (hexadecimal) initially, or the format from the
  705.      last time you used either `x' or `print'.
  706.  
  707. U, the unit size
  708.      The unit size is any of
  709.     `b'
  710.           Bytes.
  711.  
  712.     `h'
  713.           Halfwords (two bytes).
  714.  
  715.     `w'
  716.           Words (four bytes).  This is the initial default.
  717.  
  718.     `g'
  719.           Giant words (eight bytes).
  720.  
  721.      Each time you specify a unit size with `x', that size becomes the
  722.      default unit the next time you use `x'.  (For the `s' and `i'
  723.      formats, the unit size is ignored and is normally not written.)
  724.  
  725. ADDR, starting display address
  726.      ADDR is the address where you want GDB to begin displaying
  727.      memory.  The expression need not have a pointer value (though it
  728.      may); it is always interpreted as an integer address of a byte of
  729.      memory.  *Note Expressions: Expressions, for more information on
  730.      expressions.  The default for ADDR is usually just after the last
  731.      address examined--but several other commands also set the default
  732.      address: `info breakpoints' (to the address of the last
  733.      breakpoint listed), `info line' (to the starting address of a
  734.      line), and `print' (if you use it to display a value from memory).
  735.  
  736.    For example, `x/3uh 0x54320' is a request to display three halfwords
  737. (`h') of memory, formatted as unsigned decimal integers (`u'),
  738. starting at address `0x54320'.  `x/4xw $sp' prints the four words
  739. (`w') of memory above the stack pointer (here, `$sp'; *note
  740. Registers::.) in hexadecimal (`x').
  741.  
  742.    Since the letters indicating unit sizes are all distinct from the
  743. letters specifying output formats, you do not have to remember whether
  744. unit size or format comes first; either order will work.  The output
  745. specifications `4xw' and `4wx' mean exactly the same thing.  (However,
  746. the count N must come first; `wx4' will not work.)
  747.  
  748.    Even though the unit size U is ignored for the formats `s' and `i',
  749. you might still want to use a count N; for example, `3i' specifies
  750. that you want to see three machine instructions, including any
  751. operands.  The command `disassemble' gives an alternative way of
  752. inspecting machine instructions; *note Machine Code::..
  753.  
  754.    All the defaults for the arguments to `x' are designed to make it
  755. easy to continue scanning memory with minimal specifications each time
  756. you use `x'.  For example, after you have inspected three machine
  757. instructions with `x/3i ADDR', you can inspect the next seven with
  758. just `x/7'.  If you use RET to repeat the `x' command, the repeat
  759. count N is used again; the other arguments default as for successive
  760. uses of `x'.
  761.  
  762.    The addresses and contents printed by the `x' command are not saved
  763. in the value history because there is often too much of them and they
  764. would get in the way.  Instead, GDB makes these values available for
  765. subsequent use in expressions as values of the convenience variables
  766. `$_' and `$__'.  After an `x' command, the last address examined is
  767. available for use in expressions in the convenience variable `$_'. 
  768. The contents of that address, as examined, are available in the
  769. convenience variable `$__'.
  770.  
  771.    If the `x' command has a repeat count, the address and contents
  772. saved are from the last memory unit printed; this is not the same as
  773. the last address printed if several units were printed on the last
  774. line of output.
  775.  
  776. 
  777. File: gdb.info,  Node: Auto Display,  Next: Print Settings,  Prev: Memory,  Up: Data
  778.  
  779. Automatic Display
  780. =================
  781.  
  782.    If you find that you want to print the value of an expression
  783. frequently (to see how it changes), you might want to add it to the
  784. "automatic display list" so that GDB will print its value each time
  785. your program stops.  Each expression added to the list is given a
  786. number to identify it; to remove an expression from the list, you
  787. specify that number.  The automatic display looks like this:
  788.  
  789.      2: foo = 38
  790.      3: bar[5] = (struct hack *) 0x3804
  791.  
  792. showing item numbers, expressions and their current values.  As with
  793. displays you request manually using `x' or `print', you can specify
  794. the output format you prefer; in fact, `display' decides whether to
  795. use `print' or `x' depending on how elaborate your format
  796. specification is--it uses `x' if you specify a unit size, or one of
  797. the two formats (`i' and `s') that are only supported by `x';
  798. otherwise it uses `print'.
  799.  
  800. `display EXP'
  801.      Add the expression EXP to the list of expressions to display each
  802.      time your program stops.  *Note Expressions: Expressions.
  803.  
  804.      `display' will not repeat if you press RET again after using it.
  805.  
  806. `display/FMT EXP'
  807.      For FMT specifying only a display format and not a size or count,
  808.      add the expression EXP to the auto-display list but arranges to
  809.      display it each time in the specified format FMT.  *Note Output
  810.      formats::.
  811.  
  812. `display/FMT ADDR'
  813.      For FMT `i' or `s', or including a unit-size or a number of
  814.      units, add the expression ADDR as a memory address to be examined
  815.      each time your program stops.  Examining means in effect doing
  816.      `x/FMT ADDR'.  *Note Examining Memory: Memory.
  817.  
  818.    For example, `display/i $pc' can be helpful, to see the machine
  819. instruction about to be executed each time execution stops (`$pc' is a
  820. common name for the program counter; *note Registers::.).
  821.  
  822. `undisplay DNUMS...'
  823. `delete display DNUMS...'
  824.      Remove item numbers DNUMS from the list of expressions to display.
  825.  
  826.      `undisplay' will not repeat if you press RET after using it. 
  827.      (Otherwise you would just get the error `No display number ...'.)
  828.  
  829. `disable display DNUMS...'
  830.      Disable the display of item numbers DNUMS.  A disabled display
  831.      item is not printed automatically, but is not forgotten.  It may
  832.      be enabled again later.
  833.  
  834. `enable display DNUMS...'
  835.      Enable display of item numbers DNUMS.  It becomes effective once
  836.      again in auto display of its expression, until you specify
  837.      otherwise.
  838.  
  839. `display'
  840.      Display the current values of the expressions on the list, just
  841.      as is done when your program stops.
  842.  
  843. `info display'
  844.      Print the list of expressions previously set up to display
  845.      automatically, each one with its item number, but without showing
  846.      the values.  This includes disabled expressions, which are marked
  847.      as such.  It also includes expressions which would not be
  848.      displayed right now because they refer to automatic variables not
  849.      currently available.
  850.  
  851.    If a display expression refers to local variables, then it does not
  852. make sense outside the lexical context for which it was set up.  Such
  853. an expression is disabled when execution enters a context where one of
  854. its variables is not defined.  For example, if you give the command
  855. `display last_char' while inside a function with an argument
  856. `last_char', then this argument will be displayed while your program
  857. continues to stop inside that function.  When it stops elsewhere--where
  858. there is no variable `last_char'--display is disabled.  The next time
  859. your program stops where `last_char' is meaningful, you can enable the
  860. display expression once again.
  861.  
  862. 
  863. File: gdb.info,  Node: Print Settings,  Next: Value History,  Prev: Auto Display,  Up: Data
  864.  
  865. Print Settings
  866. ==============
  867.  
  868.    GDB provides the following ways to control how arrays, structures,
  869. and symbols are printed.
  870.  
  871. These settings are useful for debugging programs in any language:
  872.  
  873. `set print address'
  874. `set print address on'
  875.      GDB will print memory addresses showing the location of stack
  876.      traces, structure values, pointer values, breakpoints, and so
  877.      forth, even when it also displays the contents of those
  878.      addresses.  The default is on.  For example, this is what a stack
  879.      frame display looks like, with `set print address on':
  880.  
  881.           (gdb) f
  882.           #0  set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  883.               at input.c:530
  884.           530         if (lquote != def_lquote)
  885.  
  886. `set print address off'
  887.      Do not print addresses when displaying their contents.  For
  888.      example, this is the same stack frame displayed with `set print
  889.      address off':
  890.  
  891.           (gdb) set print addr off
  892.           (gdb) f
  893.           #0  set_quotes (lq="<<", rq=">>") at input.c:530
  894.           530         if (lquote != def_lquote)
  895.  
  896. `show print address'
  897.      Show whether or not addresses are to be printed.
  898.  
  899. `set print array'
  900. `set print array on'
  901.      GDB will pretty print arrays.  This format is more convenient to
  902.      read, but uses more space.  The default is off.
  903.  
  904. `set print array off.'
  905.      Return to compressed format for arrays.
  906.  
  907. `show print array'
  908.      Show whether compressed or pretty format is selected for
  909.      displaying arrays.
  910.  
  911. `set print elements NUMBER-OF-ELEMENTS'
  912.      If GDB is printing a large array, it will stop printing after it
  913.      has printed the number of elements set by the `set print
  914.      elements' command.  This limit also applies to the display of
  915.      strings.
  916.  
  917. `show print elements'
  918.      Display the number of elements of a large array that GDB will
  919.      print before losing patience.
  920.  
  921. `set print pretty on'
  922.      Cause GDB to print structures in an indented format with one
  923.      member per line, like this:
  924.  
  925.           $1 = {
  926.             next = 0x0,
  927.             flags = {
  928.               sweet = 1,
  929.               sour = 1
  930.             },
  931.             meat = 0x54 "Pork"
  932.           }
  933.  
  934. `set print pretty off'
  935.      Cause GDB to print structures in a compact format, like this:
  936.  
  937.           $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, meat \
  938.           = 0x54 "Pork"}
  939.  
  940.      This is the default format.
  941.  
  942. `show print pretty'
  943.      Show which format GDB will use to print structures.
  944.  
  945. `set print sevenbit-strings on'
  946.      Print using only seven-bit characters; if this option is set, GDB
  947.      will display any eight-bit characters (in strings or character
  948.      values) using the notation `\'NNN.  For example, `M-a' is
  949.      displayed as `\341'.
  950.  
  951. `set print sevenbit-strings off'
  952.      Print using either seven-bit or eight-bit characters, as
  953.      required.  This is the default.
  954.  
  955. `show print sevenbit-strings'
  956.      Show whether or not GDB will print only seven-bit characters.
  957.  
  958. `set print union on'
  959.      Tell GDB to print unions which are contained in structures.  This
  960.      is the default setting.
  961.  
  962. `set print union off'
  963.      Tell GDB not to print unions which are contained in structures.
  964.  
  965. `show print union'
  966.      Ask GDB whether or not it will print unions which are contained in
  967.      structures.
  968.  
  969.      For example, given the declarations
  970.  
  971.           typedef enum {Tree, Bug} Species;
  972.           typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  973.           typedef enum {Caterpillar, Cocoon, Butterfly}
  974.                         Bug_forms;
  975.           
  976.           struct thing {
  977.             Species it;
  978.             union {
  979.               Tree_forms tree;
  980.               Bug_forms bug;
  981.             } form;
  982.           };
  983.           
  984.           struct thing foo = {Tree, {Acorn}};
  985.  
  986.      with `set print union on' in effect `p foo' would print
  987.  
  988.           $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  989.  
  990.      and with `set print union off' in effect it would print
  991.  
  992.           $1 = {it = Tree, form = {...}}
  993.  
  994. These settings are of interest when debugging C++ programs:
  995.  
  996. `set print demangle'
  997. `set print demangle on'
  998.      Print C++ names in their source form rather than in the mangled
  999.      form in which they are passed to the assembler and linker for
  1000.      type-safe linkage.  The default is on.
  1001.  
  1002. `show print demangle'
  1003.      Show whether C++ names will be printed in mangled or demangled
  1004.      form.
  1005.  
  1006. `set print asm-demangle'
  1007. `set print asm-demangle on'
  1008.      Print C++ names in their source form rather than their mangled
  1009.      form, even in assembler code printouts such as instruction
  1010.      disassemblies.  The default is off.
  1011.  
  1012. `show print asm-demangle'
  1013.      Show whether C++ names in assembly listings will be printed in
  1014.      mangled or demangled form.
  1015.  
  1016. `set print object'
  1017. `set print object on'
  1018.      When displaying a pointer to an object, identify the *actual*
  1019.      (derived) type of the object rather than the *declared* type,
  1020.      using the virtual function table.
  1021.  
  1022. `set print object off'
  1023.      Display only the declared type of objects, without reference to
  1024.      the virtual function table.  This is the default setting.
  1025.  
  1026. `show print object'
  1027.      Show whether actual, or declared, object types will be displayed.
  1028.  
  1029. `set print vtbl'
  1030. `set print vtbl on'
  1031.      Pretty print C++ virtual function tables.  The default is off.
  1032.  
  1033. `set print vtbl off'
  1034.      Do not pretty print C++ virtual function tables.
  1035.  
  1036. `show print vtbl'
  1037.      Show whether C++ virtual function tables are pretty printed, or
  1038.      not.
  1039.  
  1040. 
  1041. File: gdb.info,  Node: Value History,  Next: Convenience Vars,  Prev: Print Settings,  Up: Data
  1042.  
  1043. Value History
  1044. =============
  1045.  
  1046.    Values printed by the `print' command are saved in GDB's "value
  1047. history" so that you can refer to them in other expressions.  Values
  1048. are kept until the symbol table is re-read or discarded (for example
  1049. with the `file' or `symbol-file' commands).  When the symbol table
  1050. changes, the value history is discarded, since the values may contain
  1051. pointers back to the types defined in the symbol table.
  1052.  
  1053.    The values printed are given "history numbers" for you to refer to
  1054. them by.  These are successive integers starting with one.  `print'
  1055. shows you the history number assigned to a value by printing `$NUM = '
  1056. before the value; here NUM is the history number.
  1057.  
  1058.    To refer to any previous value, use `$' followed by the value's
  1059. history number.  The way `print' labels its output is designed to
  1060. remind you of this.  Just `$' refers to the most recent value in the
  1061. history, and `$$' refers to the value before that.  `$$N' refers to
  1062. the Nth value from the end; `$$2' is the value just prior to `$$',
  1063. `$$1' is equivalent to `$$', and `$$0' is equivalent to `$'.
  1064.  
  1065.    For example, suppose you have just printed a pointer to a structure
  1066. and want to see the contents of the structure.  It suffices to type
  1067.  
  1068.      p *$
  1069.  
  1070.    If you have a chain of structures where the component `next' points
  1071. to the next one, you can print the contents of the next one with this:
  1072.  
  1073.      p *$.next
  1074.  
  1075. You can print successive links in the chain by repeating this
  1076. command--which you can do by just typing RET.
  1077.  
  1078.    Note that the history records values, not expressions.  If the
  1079. value of `x' is 4 and you type these commands:
  1080.  
  1081.      print x
  1082.      set x=5
  1083.  
  1084. then the value recorded in the value history by the `print' command
  1085. remains 4 even though the value of `x' has changed.
  1086.  
  1087. `show values'
  1088.      Print the last ten values in the value history, with their item
  1089.      numbers.  This is like `p $$9' repeated ten times, except that
  1090.      `show values' does not change the history.
  1091.  
  1092. `show values N'
  1093.      Print ten history values centered on history item number N.
  1094.  
  1095. `show values +'
  1096.      Print ten history values just after the values last printed.  If
  1097.      no more values are available, produces no display.
  1098.  
  1099.    Pressing RET to repeat `show values N' has exactly the same effect
  1100. as `show values +'.
  1101.  
  1102. 
  1103. File: gdb.info,  Node: Convenience Vars,  Next: Registers,  Prev: Value History,  Up: Data
  1104.  
  1105. Convenience Variables
  1106. =====================
  1107.  
  1108.    GDB provides "convenience variables" that you can use within GDB to
  1109. hold on to a value and refer to it later.  These variables exist
  1110. entirely within GDB; they are not part of your program, and setting a
  1111. convenience variable has no direct effect on further execution of your
  1112. program.  That is why you can use them freely.
  1113.  
  1114.    Convenience variables are prefixed with `$'.  Any name preceded by
  1115. `$' can be used for a convenience variable, unless it is one of the
  1116. predefined machine-specific register names (*note Registers::.). 
  1117. (Value history references, in contrast, are *numbers* preceded by `$'.
  1118.  *Note Value History: Value History.)
  1119.  
  1120.    You can save a value in a convenience variable with an assignment
  1121. expression, just as you would set a variable in your program.  Example:
  1122.  
  1123.      set $foo = *object_ptr
  1124.  
  1125. would save in `$foo' the value contained in the object pointed to by
  1126. `object_ptr'.
  1127.  
  1128.    Using a convenience variable for the first time creates it; but its
  1129. value is `void' until you assign a new value.  You can alter the value
  1130. with another assignment at any time.
  1131.  
  1132.    Convenience variables have no fixed types.  You can assign a
  1133. convenience variable any type of value, including structures and
  1134. arrays, even if that variable already has a value of a different type.
  1135.  The convenience variable, when used as an expression, has the type of
  1136. its current value.
  1137.  
  1138. `show convenience'
  1139.      Print a list of convenience variables used so far, and their
  1140.      values.  Abbreviated `show con'.
  1141.  
  1142.    One of the ways to use a convenience variable is as a counter to be
  1143. incremented or a pointer to be advanced.  For example, to print a
  1144. field from successive elements of an array of structures:
  1145.  
  1146.      set $i = 0
  1147.      print bar[$i++]->contents
  1148.      ... repeat that command by typing RET.
  1149.  
  1150.    Some convenience variables are created automatically by GDB and
  1151. given values likely to be useful.
  1152.  
  1153. `$_'
  1154.      The variable `$_' is automatically set by the `x' command to the
  1155.      last address examined (*note Examining Memory: Memory.).  Other
  1156.      commands which provide a default address for `x' to examine also
  1157.      set `$_' to that address; these commands include `info line' and
  1158.      `info breakpoint'.  The type of `$_' is `void *' except when set
  1159.      by the `x' command, in which case it is a pointer to the type of
  1160.      `$__'.
  1161.  
  1162. `$__'
  1163.      The variable `$__' is automatically set by the `x' command to the
  1164.      value found in the last address examined.  Its type is chosen to
  1165.      match the format in which the data was printed.
  1166.  
  1167. 
  1168. File: gdb.info,  Node: Registers,  Next: Floating Point Hardware,  Prev: Convenience Vars,  Up: Data
  1169.  
  1170. Registers
  1171. =========
  1172.  
  1173.    You can refer to machine register contents, in expressions, as
  1174. variables with names starting with `$'.  The names of registers are
  1175. different for each machine; use `info registers' to see the names used
  1176. on your machine.
  1177.  
  1178. `info registers'
  1179.      Print the names and values of all registers except floating-point
  1180.      registers (in the selected stack frame).
  1181.  
  1182. `info all-registers'
  1183.      Print the names and values of all registers, including
  1184.      floating-point registers.
  1185.  
  1186. `info registers REGNAME'
  1187.      Print the relativized value of register REGNAME.  REGNAME may be
  1188.      any register name valid on the machine you are using, with or
  1189.      without the initial `$'.
  1190.  
  1191.    GDB has four "standard" register names that are available (in
  1192. expressions) on most machines--whenever they do not conflict with an
  1193. architecture's canonical mnemonics for registers.  The register names
  1194. `$pc' and `$sp' are used for the program counter register and the
  1195. stack pointer.  `$fp' is used for a register that contains a pointer
  1196. to the current stack frame, and `$ps' is used for a register that
  1197. contains the processor status.  For example, you could print the
  1198. program counter in hex with
  1199.  
  1200.      p/x $pc
  1201.  
  1202. or print the instruction to be executed next with
  1203.  
  1204.      x/i $pc
  1205.  
  1206. or add four to the stack pointer (1) with
  1207.  
  1208.      set $sp += 4
  1209.  
  1210.    Whenever possible, these four standard register names are available
  1211. on your machine even though the machine has different canonical
  1212. mnemonics, so long as there is no conflict.  The `info registers'
  1213. command shows the canonical names.  For example, on the SPARC, `info
  1214. registers' displays the processor status register as `$psr' but you
  1215. can also refer to it as `$ps'.
  1216.  
  1217.    GDB always considers the contents of an ordinary register as an
  1218. integer when the register is examined in this way.  Some machines have
  1219. special registers which can hold nothing but floating point; these
  1220. registers are considered to have floating point values.  There is no
  1221. way to refer to the contents of an ordinary register as floating point
  1222. value (although you can *print* it as a floating point value with
  1223. `print/f $REGNAME').
  1224.  
  1225.    Some registers have distinct "raw" and "virtual" data formats.  This
  1226. means that the data format in which the register contents are saved by
  1227. the operating system is not the same one that your program normally
  1228. sees.  For example, the registers of the 68881 floating point
  1229. coprocessor are always saved in "extended" (raw) format, but all C
  1230. programs expect to work with "double" (virtual) format.  In such
  1231. cases, GDB normally works with the virtual format only (the format that
  1232. makes sense for your program), but the `info registers' command prints
  1233. the data in both formats.
  1234.  
  1235.    Normally, register values are relative to the selected stack frame
  1236. (*note Selecting a Frame: Selection.).  This means that you get the
  1237. value that the register would contain if all stack frames farther in
  1238. were exited and their saved registers restored.  In order to see the
  1239. true contents of hardware registers, you must select the innermost
  1240. frame (with `frame 0').
  1241.  
  1242.    However, GDB must deduce where registers are saved, from the machine
  1243. code generated by your compiler.  If some registers are not saved, or
  1244. if GDB is unable to locate the saved registers, the selected stack
  1245. frame will make no difference.
  1246.  
  1247.    ---------- Footnotes ----------
  1248.  
  1249.    (1)  This is a way of removing one word from the stack, on machines
  1250. where stacks grow downward in memory (most machines, nowadays).  This
  1251. assumes that the innermost stack frame is selected; setting `$sp' is
  1252. not allowed when other stack frames are selected.  To pop entire
  1253. frames off the stack, regardless of machine architecture, use `return';
  1254. *note Returning from a Function: Returning..
  1255.  
  1256. 
  1257. File: gdb.info,  Node: Floating Point Hardware,  Prev: Registers,  Up: Data
  1258.  
  1259. Floating Point Hardware
  1260. =======================
  1261.  
  1262.    Depending on the host machine architecture, GDB may be able to give
  1263. you more information about the status of the floating point hardware.
  1264.  
  1265. `info float'
  1266.      If available, provides hardware-dependent information about the
  1267.      floating point unit.  The exact contents and layout vary
  1268.      depending on the floating point chip.
  1269.  
  1270. 
  1271. File: gdb.info,  Node: Languages,  Next: Symbols,  Prev: Data,  Up: Top
  1272.  
  1273. Using GDB with Different Languages
  1274. **********************************
  1275.  
  1276.    Although programming languages generally have common aspects, they
  1277. are rarely expressed in the same manner.  For instance, in ANSI C,
  1278. dereferencing a pointer `p' is accomplished by `*p', but in Modula-2,
  1279. it is accomplished by `p^'.  Values can also be represented (and
  1280. displayed) differently.  Hex numbers in C are written like `0x1ae',
  1281. while in Modula-2 they appear as `1AEH'.
  1282.  
  1283.    Language-specific information is built into GDB for some languages,
  1284. allowing you to express operations like the above in your program's
  1285. native language, and allowing GDB to output values in a manner
  1286. consistent with the syntax of your program's native language.  The
  1287. language you use to build expressions, called the "working language",
  1288. can be selected manually, or GDB can set it automatically.
  1289.  
  1290. * Menu:
  1291.  
  1292. * Setting::                     Switching between source languages
  1293. * Show::                        Displaying the language
  1294. * Checks::                      Type and Range checks
  1295. * Support::                     Supported languages
  1296.  
  1297. 
  1298. File: gdb.info,  Node: Setting,  Next: Show,  Prev: Languages,  Up: Languages
  1299.  
  1300. Switching between source languages
  1301. ==================================
  1302.  
  1303.    There are two ways to control the working language--either have GDB
  1304. set it automatically, or select it manually yourself.  You can use the
  1305. `set language' command for either purpose.  On startup, GDB defaults
  1306. to setting the language automatically.
  1307.  
  1308. * Menu:
  1309.  
  1310. * Manually::                    Setting the working language manually
  1311. * Automatically::               Having GDB infer the source language
  1312.  
  1313.